<%--
  Created by IntelliJ IDEA.
  User: dell
  Date: 2021/7/29
  Time: 13:45
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link href="static/css/bootstrap.min.css?v=3.3.5" rel="stylesheet">
    <link href="static/css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
    <link href="static/css/animate.min.css" rel="stylesheet">
    <link href="static/css/myAlert.css" rel="stylesheet">
    <link href="static/css/style.min.css?v=4.0.0" rel="stylesheet"><base target="_blank">
    <style type="text/css">
        button{float: right}
        span{font-size: 10px}
        th{align-content: center}
        .col-sm-8{
            width: 400px;
        }
        .update{
            margin-left: 25%;
        }
        .ibox-content{
            width: 700px;
            box-shadow: 2px 2px 5px #bababa;
        }
        .subrole{
            margin-bottom: 0px;
        }
    </style>
</head>
<body>
<%--列表--%>
<div style="width: 60%;margin-left: 20%;margin-top: 10%" class="alluser">
    <h2 style="text-align: center ;color: #07c227">项目列表</h2>
    <table class="table table-hover" >
        <thead>
        <tr >
            <th>id</th>
            <th>项目名称</th>
            <th>项目编号</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody class="first">
        </tbody>
    </table>
</div>
<%--项目信息--%>
<div class="ibox-content updatemsg" style="margin-left: 20%;margin-top: 10%">
    <form class="form-horizontal" action="updateUserById" method="post">
        <h2 class="showid">项目信息</h2>
        <div class="form-group">
            <label class="col-sm-3 control-label">项目名称：</label>
            <div class="col-sm-8">
                <input type="text" placeholder="用户名" class="form-control pname" readonly>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">项目编号：</label>
            <div class="col-sm-8">
                <input type="text" placeholder="密码" class="form-control pcode" readonly>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">申报单位：</label>
            <div class="col-sm-8">
                <input type="text"  class="form-control punit" readonly>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">实施单位：</label>
            <div class="col-sm-8">
                <input type="text"  class="form-control piunit" readonly>
            </div>
        </div>
         <div class="form-group">
            <label class="col-sm-3 control-label">申报日期：</label>
            <div class="col-sm-8">
                <input type="text"  class="form-control pddate" readonly>
            </div>
        </div>
         <div class="form-group">
            <label class="col-sm-3 control-label">起始日期：</label>
            <div class="col-sm-8">
                <input type="text"  class="form-control psdate" readonly>
            </div>
        </div>
         <div class="form-group">
            <label class="col-sm-3 control-label">终止日期：</label>
            <div class="col-sm-8">
                <input type="text"  class="form-control ptdate" readonly>
            </div>
        </div>
         <div class="form-group">
            <label class="col-sm-3 control-label">负责人：</label>
            <div class="col-sm-8">
                <input type="text"  class="form-control pdirector" readonly>
            </div>
        </div>
         <div class="form-group">
            <label class="col-sm-3 control-label">联系电话：</label>
            <div class="col-sm-8">
                <input type="text"  class="form-control pphone" readonly>
            </div>
        </div>
<div class="form-group">
            <label class="col-sm-3 control-label">邮政编码：</label>
            <div class="col-sm-8">
                <input type="text"  class="form-control ppostcode" readonly>
            </div>
        </div>
<div class="form-group">
            <label class="col-sm-3 control-label">项目等级：</label>
            <div class="col-sm-8">
                <input type="text"  class="form-control pgrade" readonly>
            </div>
        </div>
<div class="form-group">
            <label class="col-sm-3 control-label">项目类型：</label>
            <div class="col-sm-8">
                <input type="text"  class="form-control ptype" readonly>
            </div>
        </div>
<div class="form-group">
            <label class="col-sm-3 control-label">项目属性：</label>
            <div class="col-sm-8">
                <input type="text"  class="form-control pattribute" readonly>
            </div>
        </div>
<div class="form-group">
            <label class="col-sm-3 control-label">申请理由：</label>
            <div class="col-sm-8">
                <input type="text"  class="form-control preson" readonly>
            </div>
        </div>
<div class="form-group">
            <label class="col-sm-3 control-label">主要成员：</label>
            <div class="col-sm-8">
                <input type="text"  class="form-control pperson" readonly>
            </div>
        </div>
<div class="form-group">
            <label class="col-sm-3 control-label">项目预算：</label>
            <div class="col-sm-8">
                <input type="text"  class="form-control pbudget" readonly>
            </div>
        </div>
<div class="form-group">
            <label class="col-sm-3 control-label">申报人：</label>
            <div class="col-sm-8">
                <input type="text"  class="form-control pdeclarant" readonly>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">受理人：</label>
            <div class="col-sm-8">
                <input type="text"  class="form-control pacceptor" readonly>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">审批人：</label>
            <div class="col-sm-8">
                <input type="text"  class="form-control papproval" readonly>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">立项人：</label>
            <div class="col-sm-8">
                <input type="text"  class="form-control psponsor" readonly>
            </div>
        </div>
          <div class="form-group">
            <label class="col-sm-3 control-label">专家意见：</label>
            <div class="col-sm-8">
                <input type="text"  class="form-control padvice" readonly>
            </div>
        </div>
          <div class="form-group">
            <label class="col-sm-3 control-label">风险评估：</label>
            <div class="col-sm-8">
                <input type="text"  class="form-control risk" readonly>
            </div>
        </div>
        <input type="button" class="btn btn-outline btn-default no" value="返回"/>
    </form>
</div>
<%--合同--%>
<div class="ibox-content contract" style="margin-left: 20%;margin-top: 10%">
    <form class="form-horizontal" action="updateUserById" method="post">
        <h2 class="showid">合同信息</h2>
        <div class="form-group">
            <label class="col-sm-3 control-label">合同名称：</label>
            <div class="col-sm-8">
                <input type="text"  class="form-control cname" readonly>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">合同编号：</label>
            <div class="col-sm-8">
                <input type="text"  class="form-control ccode" readonly>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">甲方单位：</label>
            <div class="col-sm-8">
                <input type="text"  class="form-control cjunit" readonly>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">乙方单位：</label>
            <div class="col-sm-8">
                <input type="text"  class="form-control cyunit" readonly>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">甲方地址：</label>
            <div class="col-sm-8">
                <input type="text"  class="form-control cjaddress" readonly>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">乙方地址：</label>
            <div class="col-sm-8">
                <input type="text"  class="form-control cyaddress" readonly>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">甲方电话：</label>
            <div class="col-sm-8">
                <input type="text"  class="form-control cjphone" readonly>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">乙方电话：</label>
            <div class="col-sm-8">
                <input type="text"  class="form-control cyaddresss" readonly>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">甲方开户银行：</label>
            <div class="col-sm-8">
                <input type="text"  class="form-control cjbank" readonly>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">乙方开户银行：</label>
            <div class="col-sm-8">
                <input type="text"  class="form-control cybank" readonly>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">甲方银行账号：</label>
            <div class="col-sm-8">
                <input type="text"  class="form-control cjbankcode" readonly>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">乙方银行账号：</label>
            <div class="col-sm-8">
                <input type="text"  class="form-control cybankcode" readonly>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">签订日期：</label>
            <div class="col-sm-8">
                <input type="text"  class="form-control cdate" readonly>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">合同金额：</label>
            <div class="col-sm-8">
                <input type="text"  class="form-control cmoney" readonly>
            </div>
        </div>
        <input type="button" class="btn btn-outline btn-default no2" value="返回"/>
    </form>
</div>
<%--经费--%>
<div class="ibox-content funds" style="margin-left: 20%;margin-top: 10%">
    <form class="form-horizontal" action="updateUserById" method="post">
        <h2 class="showid">经费信息</h2>
        <div class="form-group">
            <label class="col-sm-3 control-label">支出科目：</label>
            <div class="col-sm-8">
                <input type="text"  class="form-control fpayments" readonly>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">数量：</label>
            <div class="col-sm-8">
                <input type="text"  class="form-control fnumber" readonly>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">单价：</label>
            <div class="col-sm-8">
                <input type="text"  class="form-control fprice" readonly>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">购买形式：</label>
            <div class="col-sm-8">
                <input type="text"  class="form-control fform" readonly>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">金额：</label>
            <div class="col-sm-8">
                <input type="text"  class="form-control fmoney" readonly>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">日期：</label>
            <div class="col-sm-8">
                <input type="text"  class="form-control fdate" readonly>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">经办人：</label>
            <div class="col-sm-8">
                <input type="text"  class="form-control fagent" readonly>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">录入人：</label>
            <div class="col-sm-8">
                <input type="text"  class="form-control fenter" readonly>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">备注：</label>
            <div class="col-sm-8">
                <input type="text"  class="form-control fremarks" readonly>
            </div>
        </div>

        <input type="button" class="btn btn-outline btn-default no3" value="返回"/>
    </form>
</div>
<script src="static/js/jquery.min.js?v=2.1.4"></script>
<script src="static/js/bootstrap.min.js?v=3.3.5"></script>
<script src="static/js/plugins/iCheck/icheck.min.js"></script>
<script src="static/js/myAlert.js"></script>
<script src="static/js/jquery.form.min.js"></script>
<script>
    $(function (){
        $(".updatemsg").hide();
        $(".contract").hide();
        $(".funds").hide();
        $.ajax({
            url:"findAllProject2",
            method:"post",
            dataType:"json",
            success:function (data){
                for(let u=0;u<data.length;u++){
                    $(".first").append(" <tr><td id='pid'>"+data[u].pid+"</td><td id='pname'>"+data[u].pname+"</td><td>"+data[u].pcode+"</td>" +
                        "<td><input type='button' class='btn btn-outline btn-info' value='项目信息'/>" +
                        "<input type='button' class='btn btn-outline btn-warning' value='合同信息'/>" +
                        "<input type='button' class='btn btn-outline btn-danger'value='经费信息'/>" +
                        "<input type='button' class='btn btn-outline btn-success'value='验收'/>" +
                        "</td> </tr>" +
                        "</td></tr>")
                    //项目信息
                    $(".btn-info").click(function (){
                        let pid= $(this).parents("tr").find("#pid").text()
                        $(".alluser").hide();
                        $(".updatemsg").show();
                        $.ajax({
                            url:"findProjectByID2",
                            type:"post",
                            data:{pid:pid},
                            success:function (data){
                                $('.pname').val(data.pname);
                                $('.pcode').val(data.pcode);
                                $('.punit').val(data.punit);
                                $('.piunit').val(data.piunit);
                                $('.pddate').val(data.pddate);
                                $('.psdate').val(data.psdate);
                                $('.ptdate').val(data.ptdate);
                                $('.pdirector').val(data.pdirector);
                                $('.pphone').val(data.pphone);
                                $('.ppostcode').val(data.ppostcode);
                                $('.pgrade').val(data.pgrade);
                                $('.ptype').val(data.ptype);
                                $('.pattribute').val(data.pattribute);
                                $('.preson').val(data.preson);
                                $('.pperson').val(data.pperson);
                                $('.pbudget').val(data.pbudget);
                                $('.pdeclarant').val(data.pdeclarant);
                                $('.pacceptor').val(data.pacceptor);
                                $('.psponsor').val(data.psponsor);
                                $('.padvice').val(data.padvice);
                                $('.risk').val(data.risk);
                            }
                        })
                    })
                    //取消修改
                    $(".no").click(function (){
                        $(".alluser").show();
                        $(".updatemsg").hide();
                    })
                    //合同信息
                    $(".btn-warning").click(function (){
                        let pid= $(this).parents("tr").find("#pid").text()
                        $(".alluser").hide();
                        $(".contract").show();
                        $.ajax({
                            url:"findcontractByPid",
                            type:"post",
                            dataType:"json",
                            data:{pid:pid},
                            success:function (data){
                                $('.cname').val(data.pname);
                                $('.ccode').val(data.pname);
                                $('.cjunit').val(data.cjunit);
                                $('.cjaddress').val(data.cjaddress);
                                $('.cjphone').val(data.cjphone);
                                $('.cjbank').val(data.cjbank);
                                $('.cjbankcode').val(data.cjbankcode);
                                $('.cyunit').val(data.cyunit);
                                $('.cyaddress').val(data.cyaddress);
                                $('.cyuphone').val(data.cyphone);
                                $('.cybank').val(data.cybank);
                                $('.cybankcode').val(data.cybankcode);
                                $('.cdate').val(data.cdate);
                                $('.cmoney').val(data.cmoney);
                            }
                        })
                        let usid= $(this).parents("tr").find("#uid").text()
                        $(".addrole-uid").val(usid)
                    })
                    $(".no2").click(function (){
                        $(".alluser").show();
                        $(".contract").hide();
                    })
                    //取消
                    $(".norole").click(function (){
                        $(".alluser").show();
                        $(".addrole").hide();
                    })
                    //经费信息
                    $(".btn-danger").click(function (){
                        let pid= $(this).parents("tr").find("#pid").text()
                        $(".alluser").hide();
                        $(".funds").show();
                        $.ajax({
                            url:"findFundsByPID",
                            method:"post",
                            data:{pid:pid},
                            success:function (data){
                                $('.fpayments').val(data.fpayment);
                                $('.fnumber').val(data.fnumber);
                                $('.fform').val(data.fform);
                                $('.fprice').val(data.fprice);
                                $('.fmoney').val(data.fmoney);
                                $('.fdate').val(data.fdate);
                                $('.fagent').val(data.fagent);
                                $('.fenter').val(data.fenter);
                                $('.fremarks').val(data.fremarks);
                            },
                        })
                    })
                    //阻止form表单跳转
                    $(".form-horizontal").submit(function (){
                        $(this).ajaxSubmit()
                        return false;
                    })
                    $(".no3").click(function (){
                        $(".alluser").show();
                        $(".funds").hide();
                    })
                    //弹窗
                    var malert= {
                        title: "Tip",
                        msg: "操作成功",
                    }
                    $(".showal").click(function (){
                        MyAlert(malert);
                    })
                    var malert= {
                        title: "Tip",
                        msg: "操作成功",
                    }
                    $(".btn-success").click(function (){
                        let pid= $(this).parents("tr").find("#pid").text()
                        $.ajax({
                            url:"checkProject",
                            type:"post",
                            data:{pid:pid}
                        })
                        MyAlert(malert);
                    })
                }
            }
        })
    })
</script>
</body>
</html>
